package com.pk.test.business.core.web;

import java.applet.Applet;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

import com.pk.platform.business.core.web.GenericAction;

public class ScriptAction extends GenericAction {

	public String testScript() {
		ScriptEngineManager manager = new ScriptEngineManager();
		ScriptEngine engine = manager.getEngineByName("javascript");
		try {
			StringBuffer str = new StringBuffer();
			str.append("importPackage(com.pk.platform.util);");
			str.append("var x = GlobalLoader.getContext().getAttribute(\"baseDataService\");print(x.queryBaseDataById(\"backupCommand\").getDataValue())");
			engine.eval(str.toString());
		} catch (ScriptException ex) {
			ex.printStackTrace();
		}
		return SUCCESS;
	}
	
	public String testPageScript() throws Exception
	{
		return SUCCESS;
	}

}
